<?php $this->load->view($config['site_template'].'/head');?>
<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="row">
            <div class="col-sm-12">

                <div class="ibox">
                    <!--
                    <div class="ibox-title">
                        <h5>所有列表</h5>

                        <div class="ibox-tools">
                            <a href="projects.html" class="btn btn-primary btn-xs">创建新项目</a>
                        </div>

                    </div>
                    -->
                    <div class="ibox-content">

                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-1">
                                <button type="button" id="loading-example-btn" class="btn btn-white btn-sm"><i class="fa fa-refresh"></i> 刷新</button>
                            </div>
                            <div class="col-md-11">
                                <div class="form-inline">
<!--                                    <input type="text" placeholder="请输入异常问题描述" class="input-sm form-control"> -->
                                    <select class="input-sm form-control" id="productLineSerach" data-style="btn-primary" data-width="100%" title="请选择生产线名称">
                                        <option data-hidden="true" value="" disable>---请选择生产线名称---</option>
                                        <?php foreach ($lineData as $value):?>
                                            <option value="<?=$value['lineId']?>" <?= ($value['lineId'] === $productLine) ? "selected" : ""?>><?=$value['lineName']?></option>
                                        <?php endforeach;?>
                                    </select>
                                    <select class="input-sm form-control" id="classesSearch" data-style="btn-primary" data-width="40%" title="请选择班次">
                                        <option data-hidden="true" value="" disable>---请选择班次---</option>
                                        <?php foreach ($classesData as $value):?>
                                            <option value="<?=$value['val']?>" <?= ($value['val'] === $classes) ? "selected" : ""?>><?=$value['valName']?></option>
                                        <?php endforeach;?>
<!--                                        <option value="1" --><?//= ($classes === 1) ? "selected" : ""?><!-->白班</option>-->
<!--                                        <option value="0" --><?//= ($classes === 0) ? "selected" : ""?><!-->夜班</option>-->
                                    </select>
<!--                                    <span class="input-group-btn">-->
                                        <button type="button" id="serachBtn" class="btn btn-sm btn-primary"> 搜索 <?=$classes?></button>
<!--                                    </span>-->
                                </div>
                            </div>
                        </div>

                        <div class="project-list">

                            <table class="table table-hover">
                                <tbody>
                                    <tr>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">序号</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">填写人</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">所在部门</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">填写时间</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">生产线名称</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">班次</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">无尘毛巾、橡胶手套检查</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">橡胶手套确认</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">不锈剪刀检查</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">不锈剪刀确认</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">落地、清洁料铲检查</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">清洁料铲确认</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">长臂毛刷检查</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">电子台秤确认</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">除铁棒、橡胶锤检查</a>
                                        </td>
<!--                                        <td class="project-title">-->
<!--                                            <a href="javascript:void(0)">橡胶锤确认</a>-->
<!--                                        </td>-->
                                        <td class="project-title">
                                            <a href="javascript:void(0)">所有工具照片</a>
                                        </td>

                                        <td class="project-title" style="text-align: right;">
                                            <a href="javascript:void(0)">操作</a>
                                        </td>
                                    </tr>
                                    <?php foreach ($list as $value):?>
                                    <tr>
                                        
                                        <td class="project-status">
                                            <span class="label label-primary"><?=$value['lid']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['userName']?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['userDeptName']?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=date('Y-m-d H:i:s',$value['createTime'])?>
                                        </td>
                                        <td class="project">
                                            <?=$value['productLine']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['classes'] == 0 ? "夜班" : "白班"?>
                                        </td>
                                        <td class="project">
                                            <?=$value['isTowel'] == 0 ? "无" : "有"?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['isGloves'] == 0 ? "无" : "有"?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=$value['isCraneControl'] == 0 ? "无" : "有"?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['isScissors'] == 0 ? "无" : "有"?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=$value['isFillShovel'] == 0 ? "无" : "有"?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['isClearShovel'] == 0 ? "无" : "有"?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=$value['isBrush'] == 0 ? "无" : "有"?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['isElectronicScale'] == 0 ? "无" : "有"?>
<!--                                        </td>-->
                                        <td class="project">
                                            <?=$value['isRemoveIronBar'] == 0 ? "无" : "有"?>
                                        </td>
<!--                                        <td class="project">-->
<!--                                            --><?//=$value['isRubberHammer'] == 0 ? "无" : "有"?>
<!--                                        </td>-->
                                        <td class="social-avatar">
                                            <a href="javascript:void(0)">
                                                <?php if(strlen($value['toolCaseImgSrc'])  > 0):?>
                                                <img alt="image" class="img" id="toolCaseImgSrc" src="<?=  base_url().$value['toolCaseImgSrc']?>">
                                                <?php endif;?>
                                            </a>
                                        </td>
                                        <td class="project-actions">
                                            <a href="javascript:void(0)" class="btn btn-white btn-sm showOrder"><input type="hidden" name="id" value="<?=$value['id']?>"><i class="fa fa-folder"></i> 查看 </a>
                                            <!--<a href="projects.html#" class="btn btn-white btn-sm"><i class="fa fa-pencil"></i> 编辑 </a>-->
                                        </td>
                                       
                                    </tr>
                                    <?php endforeach;?>
                                    </tbody>
                                    
                                    
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <script>
       $(document).ready(function() {
            $("#loading-example-btn").click(function() {
                btn = $(this);
                simpleLoad(btn, true);
                simpleLoad(btn, false)
                var productLineSerach = $("#productLineSerach option:selected").val();
                var classesSearch = $("#classesSearch option:selected").val();
                window.location.href = "<?=base_url('XunJian_YiPei/dataAllList_GJDJB?productLine=')?>" + productLineSerach + "&classes=" + classesSearch;
            })
            $('.img').click(function(){
                var src = $(this).attr("src")
                var id = $(this).attr("id");
                var showText;
                if(id == "toolCaseImgSrc"){
                    showText = "工具箱照片";
                }
                $(".showText").text(showText);
                $("#thumb").attr('src',src);
                $(".showThumb").click();
            });
            $("#serachBtn").click(function () {
                var productLineSerach = $("#productLineSerach option:selected").val();
                var classesSearch = $("#classesSearch option:selected").val();
                window.location.href = "<?=base_url('XunJian_YiPei/dataAllList_GJDJB?productLine=')?>" + productLineSerach + "&classes=" + classesSearch;
            });
            $(".showOrder").click(function(){
                var id = $(this).find("[name=id]").val();
                $.ajax({
                    type:"GET",
                    url:'<?=base_url("XunJian_YiPei/getSingleContent_GJDJB?id=")?>'+id,
                    dataType: "json",
                    success:function(data){
                        if(data.userName.length > 0){
                            $("#userName").html(data.userName);
                        }else{
                            $("#userName").html("无数据");
                        }
                        // if(data.userDeptName.length > 0){
                        //     $("#userDeptName").html(data.userDeptName);
                        // }else{
                        //     $("#userDeptName").html("无数据");
                        // }
                        if(data.createTime.length > 0){
                            $("#createTime").html(data.createTime);
                        }else{
                            $("#createTime").html("无数据");
                        }
                        if(data.productLine.length > 0){
                            $("#productLine").html(data.productLine);
                        }else{
                            $("#productLine").html("无数据");
                        }
                        if(data.classes.length > 0){
                            var classes;
                            if(data.classes == 0){
                                classes = "夜班";
                            }else if(data.classes == 1){
                                classes = "白班";
                            }
                            $("#classes").html(classes);
                        }else{
                            $("#classes").html("无数据");
                        }
                        if(data.isTowel.length > 0){
                            var isTowel;
                            if(data.isTowel == 0){
                                isTowel = "无";
                            }else if(data.isTowel == 1){
                                isTowel = "有";
                            }
                            $("#isTowel").html(isTowel);
                        }else{
                            $("#isTowel").html("无数据");
                        }
                        // if(data.isGloves.length > 0){
                        //     var isGloves;
                        //     if(data.isGloves == 0){
                        //         isGloves = "无";
                        //     }else if(data.isGloves == 1){
                        //         isGloves = "有";
                        //     }
                        //     $("#isGloves").html(isGloves);
                        // }else{
                        //     $("#isGloves").html("无数据");
                        // }
                        if(data.isCraneControl.length > 0){
                            var isCraneControl;
                            if(data.isCraneControl == 0){
                                isCraneControl = "无";
                            }else if(data.isCraneControl == 1){
                                isCraneControl = "有";
                            }
                            $("#isCraneControl").html(isCraneControl);
                        }else{
                            $("#isCraneControl").html("无数据");
                        }
                        // if(data.isScissors.length > 0){
                        //     var isScissors;
                        //     if(data.isScissors == 0){
                        //         isScissors = "无";
                        //     }else if(data.isScissors == 1){
                        //         isScissors = "有";
                        //     }
                        //     $("#isScissors").html(isScissors);
                        // }else{
                        //     $("#isScissors").html("无数据");
                        // }
                        if(data.isFillShovel.length > 0){
                            var isFillShovel;
                            if(data.isFillShovel == 0){
                                isFillShovel = "无";
                            }else if(data.isFillShovel == 1){
                                isFillShovel = "有";
                            }
                            $("#isFillShovel").html(isFillShovel);
                        }else{
                            $("#isFillShovel").html("无数据");
                        }
                        // if(data.isClearShovel.length > 0){
                        //     var isClearShovel;
                        //     if(data.isClearShovel == 0){
                        //         isClearShovel = "无";
                        //     }else if(data.isClearShovel == 1){
                        //         isClearShovel = "有";
                        //     }
                        //     $("#isClearShovel").html(isClearShovel);
                        // }else{
                        //     $("#isClearShovel").html("无数据");
                        // }
                        if(data.isBrush.length > 0){
                            var isBrush;
                            if(data.isBrush == 0){
                                isBrush = "无";
                            }else if(data.isBrush == 1){
                                isBrush = "有";
                            }
                            $("#isBrush").html(isBrush);
                        }else{
                            $("#isBrush").html("无数据");
                        }
                        // if(data.isElectronicScale.length > 0){
                        //     var isElectronicScale;
                        //     if(data.isElectronicScale == 0){
                        //         isElectronicScale = "无";
                        //     }else if(data.isElectronicScale == 1){
                        //         isElectronicScale = "有";
                        //     }
                        //     $("#isElectronicScale").html(isElectronicScale);
                        // }else{
                        //     $("#isElectronicScale").html("无数据");
                        // }
                        if(data.isRemoveIronBar.length > 0){
                            var isRemoveIronBar;
                            if(data.isRemoveIronBar == 0){
                                isRemoveIronBar = "无";
                            }else if(data.isRemoveIronBar == 1){
                                isRemoveIronBar = "有";
                            }
                            $("#isRemoveIronBar").html(isRemoveIronBar);
                        }else{
                            $("#isRemoveIronBar").html("无数据");
                        }
                        // if(data.isRubberHammer.length > 0){
                        //     var isRubberHammer;
                        //     if(data.isRubberHammer == 0){
                        //         isRubberHammer = "无";
                        //     }else if(data.isRubberHammer == 1){
                        //         isRubberHammer = "有";
                        //     }
                        //     $("#isRubberHammer").html(isRubberHammer);
                        // }else{
                        //     $("#isRubberHammer").html("无数据");
                        // }

                        if(data.toolCaseImgSrc.length > 0){
                            $("#toolCaseImgSrcShow").html('<img src="<?=  base_url()?>'+data.toolCaseImgSrc+'" class="img-responsive" alt="Cinque Terre">');
                        }else{
                            $("#toolCaseImgSrcShow").html("无数据");
                        }
                        $(".showAbnormalQas").click();
                    }
                    
                })
            })
        });

        function simpleLoad(btn, state) {
            if (state) {
                btn.children().addClass("fa-spin");
                btn.contents().last().replaceWith(" Loading")
            } else {
                setTimeout(function() {
                    btn.children().removeClass("fa-spin");
                    btn.contents().last().replaceWith(" Refresh")
                },
                2000)
            }
        };
    
        $(function () { $('#imgShow').modal('hide')});
        $(function () { $('#imgShow').on('hide.bs.modal', function () {
           //alert('嘿，我听说您喜欢模态框...');
           })
        });
    </script>
    
    </body>
    <!--异常问题截图展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showThumb" style="display: none" data-toggle="modal" data-target="#imgShow">
            演示图片模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="imgShow" tabindex="-1" role="dialog" aria-labelledby="imgShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="imgShowLabel">
                                        <div class="showText">异常问题截图</div>
                                    </h4>
                            </div>
                            <div class="modal-body">
                                    <img id="thumb" src="" class="img-responsive" alt="Cinque Terre"> 
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    
    <!--异常问题详细内容展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showAbnormalQas" style="display: none" data-toggle="modal" data-target="#AbnormalQasShow">
            异常问题详细模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="AbnormalQasShow" tabindex="-1" role="dialog" aria-labelledby="AbnormalQasShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="AbnormalQasShowLabel">
                                        工具点检表
                                    </h4>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">填写人</label>
                                    <div id="userName" class="col-sm-7 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-5 control-label well well-sm">所在部门</label>-->
<!--                                    <div id="userDeptName" class="col-sm-7 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">填写时间</label>
                                    <div id="createTime" class="col-sm-7 well well-sm">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">生产线名称</label>
                                    <div id="productLine" class="col-sm-7 well well-sm">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">班次</label>
                                    <div id="classes" class="col-sm-7 well well-sm">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">无尘毛巾、橡胶手套检查</label>
                                    <div id="isTowel" class="col-sm-7 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-5 control-label well well-sm">橡胶手套确认</label>-->
<!--                                    <div id="isGloves" class="col-sm-7 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">不锈剪刀检查</label>
                                    <div id="isCraneControl" class="col-sm-7 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-5 control-label well well-sm">不锈剪刀确认</label>-->
<!--                                    <div id="isScissors" class="col-sm-7 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">落地、清洁料铲检查</label>
                                    <div id="isFillShovel" class="col-sm-7 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-5 control-label well well-sm">清洁料铲确认</label>-->
<!--                                    <div id="isClearShovel" class="col-sm-7 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">长臂毛刷检查</label>
                                    <div id="isBrush" class="col-sm-7 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-5 control-label well well-sm">电子台秤确认</label>-->
<!--                                    <div id="isElectronicScale" class="col-sm-7 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">除铁棒、橡胶锤检查</label>
                                    <div id="isRemoveIronBar" class="col-sm-7 well well-sm">
                                    </div>
                                </div>
<!--                                <div class="form-group">-->
<!--                                    <label class="col-sm-5 control-label well well-sm">橡胶锤确认</label>-->
<!--                                    <div id="isRubberHammer" class="col-sm-7 well well-sm">-->
<!--                                    </div>-->
<!--                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-5 control-label well well-sm">所有工具照片</label>
                                    <div id="toolCaseImgSrcShow" class="col-sm-7 well well-sm">11</div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
<?php $this->load->view($config['site_template'].'/foot');?>